unit Class_WGFL_DX;

interface
uses
  Classes,SysUtils,FireDAC.Stan.Intf, FireDAC.Stan.Option,
  FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
  FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.MSSQL,
  FireDAC.Phys.MSSQLDef, Data.DB, FireDAC.Comp.Client, FireDAC.Stan.Param,
  FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt, FireDAC.Comp.DataSet,
  FireDAC.VCLUI.Wait, FireDAC.Comp.UI;

type
  TWAGEDX=class(TObject)
  private
    FUNITLINK : string;
    FGZJGIDEX : Integer;
    FWAGEKJND : Integer;
    FWAGEKJQJ : Integer;
    FWAGEIDEX : Integer;
    FSTAFIDEX : Integer;
    FSTAFBDID : Integer;
    FSTAFTYPE : Integer;
    FSTAFBANK : string;
    FSTAFNUMB : string;
    FWAGEGSND : Integer;
    FWAGEGSQJ : Integer;
    FGSNDGSQJ : Integer;
    FKJNDKJQJ : Integer;
    FHOLDTYPE : Integer;
    FISDEALED : Integer;
    FHOLDFROM : Integer;
    FISHOLDED : Integer;
  public
    FListData : TStringList;
  public
    function GetObjtIdentity:string;
  public
    destructor  Destroy; override;
    constructor Create;
  published
    property UNITLINK : string read FUNITLINK  write FUNITLINK;
    property GZJGIDEX : Integer read FGZJGIDEX  write FGZJGIDEX;
    property WAGEKJND : Integer read FWAGEKJND  write FWAGEKJND;
    property WAGEKJQJ : Integer read FWAGEKJQJ  write FWAGEKJQJ;
    property WAGEIDEX : Integer read FWAGEIDEX  write FWAGEIDEX;
    property STAFIDEX : Integer read FSTAFIDEX  write FSTAFIDEX;
    property STAFBDID : Integer read FSTAFBDID  write FSTAFBDID;
    property STAFTYPE : Integer read FSTAFTYPE  write FSTAFTYPE;
    property STAFBANK : string read FSTAFBANK  write FSTAFBANK;
    property STAFNUMB : string read FSTAFNUMB  write FSTAFNUMB;
    property WAGEGSND : Integer read FWAGEGSND  write FWAGEGSND;
    property WAGEGSQJ : Integer read FWAGEGSQJ  write FWAGEGSQJ;
    property GSNDGSQJ : Integer read FGSNDGSQJ  write FGSNDGSQJ;
    property KJNDKJQJ : Integer read FKJNDKJQJ  write FKJNDKJQJ;
    property HOLDTYPE : Integer read FHOLDTYPE  write FHOLDTYPE;
    property ISDEALED : Integer read FISDEALED  write FISDEALED;
    property HOLDFROM : Integer read FHOLDFROM  write FHOLDFROM;
    property ISHOLDED : Integer read FISHOLDED  write FISHOLDED;
  public
    class function  ReadDS(AUniQuery:TFDQuery):TWAGEDX;
  end;

implementation

{ TWAGEDX }

constructor TWAGEDX.Create;
begin
  FListData:=TStringList.Create;
end;

destructor TWAGEDX.Destroy;
begin
  if FListData <>nil then FreeAndNil(FListData);
  inherited;
end;

function TWAGEDX.GetObjtIdentity: string;
begin
  Result:=Format('%S-%D-%D-%D-%D-%D',[FUNITLINK,FGZJGIDEX,FWAGEKJND,FWAGEKJQJ,FWAGEIDEX,FSTAFIDEX]);
end;

class function TWAGEDX.ReadDS(AUniQuery:TFDQuery):TWAGEDX;
var
  I:Integer;
  Field:TField;
  FNAME:string;
begin
  Result:=TWAGEDX.Create;

  with TWAGEDX(Result) do
  begin
    for I:=0 to AUniQuery.Fields.Count-1 do
    begin
      Field:=AUniQuery.Fields.Fields[I];
      FName:=UpperCase(Field.FieldName);
      if FNAME='UNIT_LINK' then
      begin
        UNITLINK :=Field.AsString;
      end else
      if FNAME='GZJG_IDEX' then
      begin
        GZJGIDEX :=Field.AsInteger;
      end else
      if FNAME='WAGE_KJND' then
      begin
        WAGEKJND :=Field.AsInteger;
      end else
      if FNAME='WAGE_KJQJ' then
      begin
        WAGEKJQJ :=Field.AsInteger;
      end else
      if FNAME='WAGE_IDEX' then
      begin
        WAGEIDEX :=Field.AsInteger;
      end else
      if FNAME='STAF_IDEX' then
      begin
        STAFIDEX :=Field.AsInteger;
      end else
      if FNAME='STAF_BDID' then
      begin
        STAFBDID :=Field.AsInteger;
      end else
      if FNAME='STAF_TYPE' then
      begin
        STAFTYPE :=Field.AsInteger;
      end else
      if FNAME='STAF_BANK' then
      begin
        STAFBANK :=Field.AsString;
      end else
      if FNAME='STAF_NUMB' then
      begin
        STAFNUMB :=Field.AsString;
      end else
      if FNAME='WAGE_GSND' then
      begin
        WAGEGSND :=Field.AsInteger;
      end else
      if FNAME='WAGE_GSQJ' then
      begin
        WAGEGSQJ :=Field.AsInteger;
      end else
      if FNAME='GSND_GSQJ' then
      begin
        GSNDGSQJ :=Field.AsInteger;
      end else
      if FNAME='KJND_KJQJ' then
      begin
        KJNDKJQJ :=Field.AsInteger;
      end else
      if FNAME='HOLD_TYPE' then
      begin
        HOLDTYPE :=Field.AsInteger;
      end else
      if FNAME='IS_DEALED' then
      begin
        ISDEALED :=Field.AsInteger;
      end else
      if FNAME='HOLD_FROM' then
      begin
        HOLDFROM :=Field.AsInteger;
      end else
      if FNAME='IS_HOLDED' then
      begin
        ISHOLDED :=Field.AsInteger;
      end;
    end
  end;
end;



end.

